using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Crossborder.Common.Utility.Encrypt;
using Crossborder.Domian.Users;

namespace Crossborder.Service.Users
{
    public partial class UserService
    {
        private async Task<bool> CreatePassword(string userId, string password)
        {
            var pwd = MD5Helper.MD5EncryptFor32(password);
            UserPassword entity = new()
            {
                UserId = userId,
                Password = pwd
            };
            entity.Create();
            var result = await _PwdRep.InsertAsync(entity);
            if (result != null)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}